﻿using System;
using System.Collections;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            Queue queue = new Queue();
            queue.Enqueue("太阳");
            queue.Enqueue("月亮");
            queue.Enqueue("星星");
            //Peek
            //while (queue.Count != 0)
            //{
            //    var i = queue.Peek();
            //    Console.WriteLine(i);
            //}
            //打印
            object[] obj = queue.ToArray();
            foreach (var i in obj)
            {
                Console.WriteLine(i);
            }
            //获取个数,移除，再获取个数
            Console.WriteLine(queue.Count);
            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Count);
            //判断某个元素是否在Queue中
            bool a = queue.Contains("星星");
            Console.WriteLine(a);
            //CopyTo
            string[] str = { "春风", "夏雷", "秋雨", "冬雪" };
            string[] str1 = new string[str.Length];
            str.CopyTo(str1,0);
            for (int i = 0;i<str1.Length;i++)
            {
                Console.WriteLine(str1[i]);
            }
            //清空
            queue.Clear();
        }
    }
}
